<!DOCTYPE html>
<html lang="en" style="font-size: 100px;">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;padding:0;
        }
        #banner{
            width: 3.35rem;
            height: 1.44rem;
            margin: 0.97rem auto;
            background: #868;
        }
    </style>
</head>
<body>
    <div id="banner"></div>

    <script>
        function adapter(){
            //获取当前设备的独立像素宽度
            let cw = document.documentElement.clientWidth;
            let fontSize = cw * 100 / 375;
            //修改根标签的大小
            document.documentElement.style.fontSize = fontSize + 'px';
        }
        //绑定事件 resize 当视口的宽高改变的时候, 自动触发    on...   when的意思  当...时候
        window.onresize = adapter;
        //立即调用
        adapter();
    </script>
</body>
</html>